//@ts-check

import msgbox from './msgbox.vue'
import alert from './alert.vue'
import confirm from './confirm.vue'

import Mask from '../../others/mask/Mask'
import { isObject } from "../../../rxtools/src/ext/object";
//@ts-ignore
const show=new Mask({
    popups:{
        msgbox,
        alert,
        confirm
    },
    verticalCenter:true
}).show

export default {
    alert:opt=> show('alert',opt),
    confirm:opt=> show('confirm',opt),
    msgbox:opt=> {
        if(!opt.footer||!isObject(opt.footer)){
            throw new Error('没有找到msgbox的footer配置，或者footer配置不是一个vue组件')
        }
        msgbox.components['rx-msgbox-footer']=opt.footer;
        return show('msgbox',opt);
    }
}
